

import myInput  from '../../components/input/myInput.vue'
/*import Viewer from 'viewerjs';
import 'viewerjs/dist/viewer.css';*/

import { videoPlayer } from 'vue-video-player'
import 'video.js/dist/video-js.css'
import Keyboard from '../../components/input/keyboard.vue'
const funeralShowMixin = {
   
    
 
    name:'funeral_item_select_show',
    props:['type','styles','appid','data','dataField','gm_id','type2','depart','dw','isYtj','exkey','defaultClick','isWarehouse','postUrl','postUrlItem','isOpen','isBig','cfCheck','sfItemDatas'],
    components: {
        myInput,
        Keyboard,
        videoPlayer,
    },
    data(){
        return{
            showType:"icon",
            showTypes:"1",
            showtc:"Y",
            titlect:"",
            option: {
                    show: true,
                    sourceDom: ''
            },
            price:"",
            mealList:[],
            dialogVisibletc:false,
            dialogVisible:false,
            dialogVisible2:false,
            dialogVisible3:false,
            dialogVisible4:false,
            loading:false,
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            tableData:[],
            styles2:this.styles,
            options:[{
                label:"服务项目",
                id:"",
                children:[]
            }],
            pId:'',
            names:'',
            selectItem:{
              
            },
            selectItemxm:{},
            treePId:"",
            selectItemAmt:{},
            shows:false,
            amt_totals:'',
            sh_totals:'',
            jm_totals:'',
            className:"",
            clickItem:null,
            changePrice:false,
            isApp:sessionStorage.getItem("isApp"),
            playerOptions: {
                playbackRates: [0.5, 1.0, 1.5, 2.0], // 可选的播放速度
                autoplay: true, // 如果为true,浏览器准备好时开始回放。
                muted: false, // 默认情况下将会消除任何音频。
                loop: false, // 是否视频一结束就重新开始。
                preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频（如果浏览器支持）
                language: 'zh-CN',
                aspectRatio: '16:9', // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
                fluid: true, // 当true时，Video.js player将拥有流体大小。换句话说，它将按比例缩放以适应其容器。
                sources: [{
                    type: "video/mp4", 
                   /*type:"application/x-mpegURL",*/
                   src: '' // url地址
                }],
                poster: '', // 封面地址
                notSupportedMessage: '此视频暂无法播放，请稍后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
                controlBar: {
                    timeDivider: true, // 当前时间和持续时间的分隔符
                    durationDisplay: true, // 显示持续时间
                    remainingTimeDisplay: false, // 是否显示剩余时间功能
                    fullscreenToggle: true // 是否显示全屏按钮
                }
          },
          isshownum:'Y',
          iscf:"N",
          showImgs:[],
          showImgAll:[],
          showImgIndex:-1,

          
          showCurImgs:[],
          showCurImgIndex:-1,
          sz_ex61s:"",
          c_ex60:"",
          searchTime:null,
          oldname:""
        }
    },
    mounted() {
        
    },
    created(){
        try{
            if(this.exkey&&this.exkey.tc){
                //this.showtc=this.exkey.tc.show;
            }
        }catch(e){}
         try{
            if(this.exkey&&this.exkey.isshownum){//不显示数字
                this.isshownum=this.exkey.isshownum;
            }
        }catch(e){}
         try{
            if(this.exkey&&this.exkey.iscf){//不显示数字
                this.iscf=this.exkey.iscf;
            }
        }catch(e){}
        try{
            if(localStorage.getItem("sCode")){
                let sCode=localStorage.getItem("sCode");
                if(localStorage.getItem(sCode+"showType")){
                    this.showType=localStorage.getItem(sCode+"showType")
                }
            }
        }catch(e){}
        if(this.isYtj=='Y'){
            this.className="funeral_item_select_ytj"
        }else if(this.isOpen!='N'){
            this.className="funeral_item_select"
        }else {
           
            this.className="funeral_item_select2"
            if(this.isBig=="Y"){
                this.className="funeral_item_select2 bigFont"
            }
        }
        if(localStorage.getItem("sCode")=="dhtl"){
            this.showTypes="2"
        }
      
       /* for(let i=0;i<this.data[this.dataField].length;i++){
            let szi_ex8=this.data[this.dataField][i].szi_ex8;
            let szi_ex4=this.data[this.dataField][i].szi_ex4;
            let szi_ex2=this.data[this.dataField][i].szi_ex2;
            this.$set(this.selectItem,"id"+szi_ex8,szi_ex4);
            this.$set(this.selectItemAmt,"id"+szi_ex8,szi_ex2);
        }
        this.changeAmt();*/
        //if(this.isshownum!='N'&&this.isshownum!='A')
            this.initLoad();
        this.loadData()
        if(!this.styles){
            this.styles2="height:40VH;";
        }
      
        /*new Viewer(document.getElementById("imgs"), {
                // 配置
            });*/
    },
     watch:{
     /*   pId: function (val) {
            let sef=this;
            this.$post("bygex","byg/funeral/getFuneralSfItem",{type:this.type,pId:val}).then(data=>{
                sef.pId=val;
                sef.tableData=[];
                for(let i=0;i<data.item.length;i++){
                    let item=data.item[i];
                    if(this.selectItemAmt["id"+item.szi_ex8]){
                        item.szi_ex2=this.selectItemAmt["id"+item.szi_ex8]
                    }
                    sef.tableData.push(data.item[i])
                }
                
            })
        },*/
        names:function(val){
            this.goSearch();
        },
        depart:function(val){
            //    console.log("val==================="+val)
           // alert(2)
            this.loadData();
        },
        data:{
            handler: function (newVal) {
                if(this.isshownum!='N'&&this.isshownum!='A'){
                    for(let i=0;i<this.data[this.dataField].length;i++){
                        let szi_ex8=this.data[this.dataField][i].szi_ex8;
                        let szi_ex4=this.data[this.dataField][i].szi_ex4;
                        let szi_ex31=this.data[this.dataField][i].szi_ex31;

                        //console.log(this.data[this.dataField][i].szi_ex1+"=="+szi_ex4)
                        if(szi_ex31!='Y'){
                            this.$set(this.selectItem,"id"+szi_ex8,szi_ex4);
                            this.$set(this.selectItemxm,"id"+szi_ex8,szi_ex4);
                            
                        }
                           
                       // console.log(JSON.stringify(this.selectItem),"items=====")
                    }
                }
                
            },      
            deep: true    //深度监听
        }
    },
    methods:{
        showBigImg(item){
           
            this.showImgAll=[];
            console.log(this.showImgs,"showImgs===================")
            for(let i=0;i<this.showImgs.length;i++){
                let szi_ex1=this.showImgs[i].szi_ex1;
                let szi_ex8=this.showImgs[i].szi_ex8;
                let img=this.showImgs[i].img.split(",");
                if(item.szi_ex8==szi_ex8){
                    this.showImgIndex=this.showImgAll.length;
                }
                for(let j=0;j<img.length;j++){
                    let im={};
                    im.name=szi_ex1;
                    im.url=img[j];
                    this.showImgAll.push(im)
                }
            }
            this.dialogVisible3=true;
        },
        showBigImgPre(){
            if(this.showImgIndex>0){
                this.showImgIndex--;
            }else{
                this.$message.error('前面没有图片了');
            }
        },
        showBigImgNext(){
            if(this.showImgIndex<this.showImgAll.length-1){
                this.showImgIndex++;
            }else{
                
                this.$message.error('已到最后一张，后面没有图片了');
            }
        },
        showCurBigImgPre(){
            if(this.showCurImgIndex>0){
                this.showCurImgIndex--;
                if(showCurImgs[showCurImgIndex].types=='video'){
                    
                    let url=window.location.protocol+"//"+window.location.host+showCurImgs[showCurImgIndex].url;
                    this.playerOptions.sources[0].src=url
                }
                
            }else{
                this.$message.error('前面没有图片了');
            }
        },
        showCurBigImgNext(){
            if(this.showCurImgIndex<this.showCurImgs.length-1){
                this.showCurImgIndex++;
                if(showCurImgs[showCurImgIndex].types=='video'){
                    let url=window.location.protocol+"//"+window.location.host+showCurImgs[showCurImgIndex].url;
                    this.playerOptions.sources[0].src=url
                }
            }else{
                
                this.$message.error('已到最后一张，后面没有图片了');
            }
        },
        loadData(){
           
            let sef=this;
            this.loading=true;
            this.showImgs=[];
            this.$post(this.appid,this.postUrl,{type:this.type,gm_id:this.gm_id,type3:escape(this.type2),dw:this.dw,depart:this.depart,isWarehouse:this.isWarehouse,"isShowView":"Y"}).then(data=>{
                sef.tableData=[];
                
                
                 
                for(let i=0;i<data.item.length;i++){
                    if(!data.item[i].sf_ex50)
                    // data.item[i].sf_ex50=localStorage.getItem("imgIp")+"/rootImg/sl/zw.png"
                        data.item[i].sf_ex50="/rootImg/sl/zw3.png"
                    
                    if(!data.item[i].sf_ex58)
                    // data.item[i].sf_ex50=localStorage.getItem("imgIp")+"/rootImg/sl/zw.png"
                        data.item[i].sf_ex58="/rootImg/sl/zw3.png"
                    

                    if(data.item[i].sf_ex59!='Y')    
                        sef.tableData.push(data.item[i])

                    let imgs={};
                    imgs.szi_ex8=data.item[i].szi_ex8;
                    imgs.szi_ex1=data.item[i].szi_ex1;
                    imgs.smallImg=data.item[i].sf_ex58.split(",")[0];
                    imgs.img=data.item[i].sf_ex50;
                    this.showImgs.push(imgs);
                    
                }
               // this.sfItems=JSON.parse(JSON.stringify(sef.tableData))
                let options=data.options;
                /*let children=[]
                for(let i=0;i<options.length;i++){
                    let tree={};
                    tree.label=options[i].sf_ex2;
                    tree.id=options[i].sf_id;
                    children.push(tree);
                }
                this.options[0].children=children;*/
                let optionss=[];
                for(let i=0;i<options.length;i++){
                    if(options[i].sf_ex59!="Y"){
                        optionss.push(options[i])
                    }
                }
                this.options=optionss;

                this.shows=true;
            
                
            
                this.loading=false;
            //   alert(this.defaultClick)
                if(this.defaultClick=="Y"){
                window.setTimeout(function(){
                        if(sef.options.length>0){
                            let id_=sef.options[0].id;
                            sef.$refs.elMenu.setCheckedKeys([id_]);
                        }
                        
                    },500)
                }
                
              //  this.handleNodeClick2(children[0])
                
                /*window.setTimeout(function(){
                    let els=document.getElementsByClassName("item_li");
                    for(let i=0;i<els.length;i++){
                        new Viewer(els[i], {
                        // 配置
                        })
                    }
                },500)*/
            
                
                
            
            })
        },
        //套餐明细
        openTcmx(item){
            this.dialogVisibletc=true;
            this.titlect=item.szi_ex1+"明细"
            this.loadMeal(item.szi_ex8,item.szi_ex5)
        },
        loadMeal(id,szi_ex5){
            this.$post("bygex",this.postUrlItem,{sId:id}).then(data=>{ 
                this.mealList=[];
                for(let i=0;i<data.length;i++){
                    let szi_ex2=Number(data[i].szi_ex2);
                    if(szi_ex2>0){
                        this.mealList.push(data[i])
                    }
                }
                let data_={
                    szi_ex1:"合计",
                    szi_ex4:"",
                    szi_ex2:"",
                    szi_ex5:szi_ex5,
                    szi_ex7:""
                };
                this.mealList.push(data_)

            });
        },
        openVideo(item){
            //let url="http://8.136.193.200"+item.sf_ex57
            let url=window.location.protocol+"//"+window.location.host+item.sf_ex57
            this.playerOptions.sources[0].src=url;
            this.dialogVisible2=true;
            
        },
        checkVideo(item){

           
            console.log(item)
            if(item.sf_ex50.indexOf(".mp4")!=-1){
                this.showCurImgs=[];
                let imgstr=item.sf_ex50.split(",")
                for(let i=0;i<imgstr.length;i++){
                    let imgss={};
                    imgss.url=imgstr[i];
                    imgss.name=item.szi_ex1;
                    imgss.types=imgstr[i].indexOf(".mp4")!=-1 ? "video":"image"
                    this.showCurImgs.push(imgss);
                    if(i==0&&imgss.types=="video"){
                        let url=window.location.protocol+"//"+window.location.host+imgstr[i]
                        
                        this.playerOptions.sources[0].src=url
                    }
                    console.log("video=="+imgstr[i].indexOf(".mp4")+"="+(imgstr[i].indexOf(".mp4")!=-1 ? "video":"image"))
                }
               
                this.showCurImgIndex=0;
                console.log(this.showCurImgs,"showImgs===================")
                
                this.dialogVisible4=true;
            }
        },
         getInputValue(val){
             if(val==='del'){              
                this.price=this.price.toString().substr(0,this.price.toString().length-1);
               
            }else{
                if(this.price==null){
                    this.price=''
                }
                this.price+=val
            }
          
        },
         onFocus(ev){
            document.activeElement.blur();//禁止默认键盘
            this.$set(this.option,'show',true)
            this.$set(this.option,'sourceDom',this.$refs['keyboard'])
         },
        initLoad(){
            
             if(this.isshownum!='N'&&this.isshownum!='A'){
                this.selectItem={};
                this.selectItemAmt={};
                this.selectItemxm={}
                for(let i=0;i<this.data[this.dataField].length;i++){
                    let szi_ex8=this.data[this.dataField][i].szi_ex8;
                    let szi_ex4=this.data[this.dataField][i].szi_ex4;
                    let szi_ex2=this.data[this.dataField][i].szi_ex2;
                    let szi_ex17=this.data[this.dataField][i].szi_ex17;
                    let szi_ex31=this.data[this.dataField][i].szi_ex31;
                    if(szi_ex31=='Y')
                        continue;
                    this.$set(this.selectItem,"id"+szi_ex8,szi_ex4);
                    this.$set(this.selectItemxm,"id"+szi_ex8,szi_ex4);
                    this.$set(this.selectItemAmt,"id"+szi_ex8,szi_ex2);

                    if(szi_ex17){
                        this.$set(this.selectItem,"id"+szi_ex17,"1");//一般套餐不会选择多个
                        this.$set(this.selectItemxm,"id"+szi_ex17,"1");//一般套餐不会选择多个
                        this.$set(this.selectItemAmt,"id"+szi_ex17,szi_ex2);
                    }
                }
             }else{
                this.selectItem={};
                this.selectItemAmt={};
                this.selectItemxm={}
                for(let i=0;i<this.data[this.dataField].length;i++){
                    let szi_ex8=this.data[this.dataField][i].szi_ex8;
                    let szi_ex4=this.data[this.dataField][i].szi_ex4;
                    let szi_ex2=this.data[this.dataField][i].szi_ex2;
                    let szi_ex17=this.data[this.dataField][i].szi_ex17;
                    let szi_ex31=this.data[this.dataField][i].szi_ex31;
                    if(szi_ex31=='Y')
                        continue;
                    this.$set(this.selectItemxm,"id"+szi_ex8,szi_ex4);

                    if(szi_ex17){
                        this.$set(this.selectItemxm,"id"+szi_ex17,"1");//一般套餐不会选择多个
                    }
                }
             }
             
            this.changeAmt();
             
        },
        handleNodeClick(data, checked, node) {
            if(checked === true) {
                if(data.id==this.pId){
                    return;
                }
                this.pId=data.id;
                this.$refs.elMenu.setCheckedKeys([data.id]);
                this.handleNodeClick2(data)
            } else {
                if (this.checkedId == data.id) {
                    this.$refs.elMenu.setCheckedKeys([data.id]);
                }
            }
        },
        handleNodeClick3(data){
            
            if(data.id==this.pId){
                return;
            }
            this.pId=data.id;
            this.$refs.elMenu.setCheckedKeys([data.id]);
            this.handleNodeClick2(data);
        },
        handleNodeClick2(data) {
           
           
             let sef=this;
             this.loading=true;
             this.showImgs=[];
             this.treePId=data.id
            this.$post(this.appid,this.postUrl,{type:this.type,pId:data.id,type3:escape(this.type2),dw:this.dw,depart:this.depart,isWarehouse:this.isWarehouse}).then(data=>{
                this.loading=false;
                sef.pId=data.id;
                sef.tableData=[];
                for(let i=0;i<data.item.length;i++){
                    let item=data.item[i];
                    if(this.selectItemAmt["id"+item.szi_ex8]){
                        item.szi_ex2=this.selectItemAmt["id"+item.szi_ex8]
                    }
                    if(!data.item[i].sf_ex50)
                       // data.item[i].sf_ex50=localStorage.getItem("imgIp")+"/rootImg/sl/zw.png"
                        data.item[i].sf_ex50="/rootImg/sl/zw3.png"
                    if(!data.item[i].sf_ex58)
                       // data.item[i].sf_ex50=localStorage.getItem("imgIp")+"/rootImg/sl/zw.png"
                        data.item[i].sf_ex58="/rootImg/sl/zw3.png"
                    
                    if(data.item[i].sf_ex59!='Y')
                        sef.tableData.push(data.item[i])

                    let imgs={};
                    imgs.szi_ex8=data.item[i].szi_ex8;
                    imgs.szi_ex1=data.item[i].szi_ex1;
                    imgs.smallImg=data.item[i].sf_ex58.split(",")[0];
                    imgs.img=data.item[i].sf_ex50;
                    
                    this.showImgs.push(imgs);
                }

                /*window.setTimeout(function(){
                    let els=document.getElementsByClassName("item_li");
                    console.log("els=========================="+els.length);
                    console.log(els);
                    for(let i=0;i<els.length;i++){
                        new Viewer(els[i], {
                        // 配置
                        })
                    }
                },1000)*/
                
                
            })
        },
         changeAmt(){
            let amt=0;
            let amt_total=0;
            let amt_jm=0;
            let amt_yh=0;
            let gs_total=0;
            let gl_total=0;
            this.change=false;
            let amt_bz=0;//补助金额（目前就昆明西郊）
            for(let i=0;i<this.data[this.dataField].length;i++){
                let item=this.data[this.dataField][i];
                if(item.szi_ex31=="Y"||item.isShow=='N'){
                    continue;
                }
                let szi_ex2=Number(item.szi_ex2);
                let szi_ex4=Number(item.szi_ex4);
                let szi_ex27=item.szi_ex27;
                let szi_ex5=szi_ex2*szi_ex4;
                let szi_ex5_=item.szi_ex5;
                let szi_ex7_=item.szi_ex7;
                let szi_ex38=item.szi_ex38;
                if(szi_ex5!=szi_ex5_&&(""+szi_ex5)!="NaN"&&(""+szi_ex5_)!="NaN"){//如果总金额不一样了，才重新赋值
                     item.szi_ex5=szi_ex5;
                     this.$set(this.data[this.dataField], i , item); 
                     this.change=true;
                }
               
                
                if(szi_ex5<0)
                    amt_jm+=szi_ex5;
                
                else
                    amt_total+=szi_ex5;
                
                if(szi_ex7_.indexOf("补助")!=-1){//昆明西郊
                    amt_bz+=szi_ex5;
                }else{
                    amt+=szi_ex5;
                }
                if(szi_ex27){
                    szi_ex27=Number(szi_ex27);
                    amt-=szi_ex27;
                    amt_yh+=szi_ex27;
                }

                if(szi_ex38=='N'){
                    gl_total+=szi_ex5;
                }else{
                    gs_total+=szi_ex5;
                }
               
            }
            try{
                this.sz_ex61s=this.data["szInfo"].sz_ex61;
            }catch(e){}
            try{
                this. c_ex60=this.data["gmInfo"].c_ex60;
            }catch(e){}
           
            if(this.sz_ex61s){
                amt=amt-Number(this.sz_ex61s);
                amt_yh=amt_yh+Number(this.sz_ex61s)
            }
            if(this.c_ex60){
                amt=amt-Number(this.c_ex60);
                amt_yh=amt_yh+Number(this.c_ex60)
            }
            this.amt_totals=amt_total;
            this.jm_totals=-amt_jm;
            this.gl_totals=gl_total;
            this.gs_totals=gs_total;
            this.bz_totals=amt_bz;
            this.sh_totals=amt;
            this.yh_totals=amt_yh;
            /*let amt=0;
            let amt_total=0;
            let amt_jm=0;
            for(let i=0;i<this.data[this.dataField].length;i++){
                let item=this.data[this.dataField][i];
                let szi_ex2=Number(item.szi_ex2);
                let szi_ex4=Number(item.szi_ex4);
                let szi_ex5=szi_ex2*szi_ex4;
                let szi_ex5_=item.szi_ex5;
                if(szi_ex5!=szi_ex5_){//如果总金额不一样了，才重新赋值
                     item.szi_ex5=szi_ex5;
                     this.$set(this.data[this.dataField], i , item); 
                }
               
                amt+=szi_ex5;
                if(szi_ex5<0)
                    amt_jm+=szi_ex5;
                else
                    amt_total+=szi_ex5;
            }
            this.amt_totals=amt_total;
            this.jm_totals=-amt_jm;
            this.sh_totals=amt;*/
        },
        changeItem(items){
            let szi_ex2=Number(items.szi_ex2);
            let szi_ex4=0; 
            let index=-1;
            for(let i=0;i<this.data[this.dataField].length;i++){
                let item=this.data[this.dataField][i];
                if(item.szi_ex8==items.szi_ex8){
                    index=i;
                    szi_ex4=Number(item.szi_ex4);
                }
            }
            if(index>=0){

                this.$set(this.selectItemAmt,"id"+items.szi_ex8,szi_ex2);
                let szi_ex5=szi_ex2*szi_ex4;
                this.$set(this.data[this.dataField][index],"szi_ex2",szi_ex2);
                this.$set(this.data[this.dataField][index],"szi_ex5",szi_ex5);
                this.$emit("changeAmt","")
                this.changeAmt();
            }
            
        },
        openPrices(item){
            if(this.isApp=="Y"){
                this.openPrice(item);
            }
        },
        openPrice(item){
            if(item.szi_ex33!='Y'){
                this.clickItem=item;
                this.dialogVisible=true;
                this.changePrice=true;
            }
           
        },
        okPrice(){
            if(this.price){
                 this.clickItem.szi_ex2=this.price;
                this.dialogVisible=false;
                this.addItem(this.clickItem);
                this.price="";
                this.clickItem=null;
            }else{
                 this.$message.error('请输入金额');
            }
           
            
        },
        addItem(item){
            //alert(item.sf_ex17);
            
            item.iscf=this.iscf;
            if(item.sf_ex17){
                item.iscf=item.sf_ex17;
            }
            //alert(item.iscf)
            if(this.defaultClick=="Y"){
                let sf_ex3=item.sf_ex3;
                if(sf_ex3=="Y"){
                    let kcnum=Number(item.kcnum);
                    if(kcnum<=0){
                          this.$alert('该库存不足，不能选择', {
                            confirmButtonText: '确定',
                            callback: action => {
                              
                            }
                        });
                        return;
                    }
                }
            }
            console.log("addItem====="+item);
            let isOk=true;
            if(this.isYtj=='Y'){
                if(item.szi_ex2==""||item.szi_ex2=='0'||item.szi_ex2=='0.0'){
                    this.clickItem=item;
                    this.dialogVisible=true;
                    isOk=false;
                }
            }
           
            if(isOk){
                
                let num=0;
                if(this.changePrice){//变更了价格的，需要更改已经选择的项目价格
                    if(this.selectItem["id"+item.szi_ex8])
                        num=this.selectItem["id"+item.szi_ex8]
                    if(num==0){
                        num=1;
                        this.$set(this.selectItem, "id"+item.szi_ex8 , num); 
                        this.$emit("addItem",JSON.stringify(item))
                        this.changeAmt();
                    }else{
                        let index=-1;
                        for(let i=0;i<this.data["item"].length;i++){
                            let item_=this.data["item"][i];
                            if(item_.szi_ex8==item.szi_ex8){
                                this.$set(this.data["item"][i],"szi_ex2",item.szi_ex2)
                                this.$set(this.data["item"][i],"szi_ex5",Number(item.szi_ex2)*num)
                                break;
                            }
                        }
                    }
                }else{
                    let isOks=true;
                    let isTx=false;
                    //加号不显示数字
                    if(this.isshownum!='N'&&this.isshownum!='A'){
                        if(this.selectItem["id"+item.szi_ex8])
                            num=this.selectItem["id"+item.szi_ex8]
                        //重复提示
                        if(item.sf_ex75=="cf"&&num>=1){
                            isTx=true;
                        }
                        console.log(this.cfCheck,"this.cfCheck=======================")
                        try{
                            if(this.cfCheck){
                                let datas=null;
                                for(let h=0;h<this.tableData.length;h++){
                                    if(this.tableData[h].szi_ex8==item.szi_ex8){
                                        datas=this.tableData[h];
                                    }
                                }


                                for(let i=0;i<this.cfCheck.length;i++){
                                    let checks=this.cfCheck[i];
                                    console.log(checks,"checks==========")
                                    for(let j=0;j<this.data[this.dataField].length;j++){
                                        let field=checks.field;
                                        let val=checks.val;
                                        let val_=this.data[this.dataField][j][field];
                                        console.log("val==="+val+"=="+val_)
                                        if(val==val_){
                                            let val_2=datas[field];
                                            if(val_==val_2){
                                               
                                                this.$alert(checks.msg);
                                                isOks=false;
                                                break;
        
                                            }
                                        }
                                    }
                                }

                            }
                        }catch(e){}
                       
                        if(!isOks){
                            return;
                        }
                        if(!isTx){
                            num++;
                            this.$set(this.selectItem, "id"+item.szi_ex8 , num); 
                            this.$set(this.selectItemxm, "id"+item.szi_ex8 , num); 
                        }
                        
                
                    }else{
                        if(this.selectItemxm["id"+item.szi_ex8])
                            num=this.selectItemxm["id"+item.szi_ex8]
                        for(let i=0;i<this.data[this.dataField].length;i++){

                            let szi_ex8=this.data[this.dataField][i].szi_ex8;
                            if(szi_ex8==item.szi_ex8){
                                isOks=false;
                                break;
                            }
                        }
                        if(isOks){
                            num++;
                            this.$set(this.selectItemxm, "id"+item.szi_ex8 , num); 
                        }
                    }
                   
                    if(!isTx&&isOks){
                        console.log("addItems======sss==")
                        console.log(item)
                        this.$emit("addItem",JSON.stringify(item))
                        this.changeAmt();
                    }
                    if(!isOks){
                        this.$alert("该项目已经存在，请不要重复添加")
                    }
                    //alert(isTx)
                    if(isTx){
                        this.$confirm('该项目已存在，是否继续添加?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                            }).then(() => {
                                num++;
                                this.$set(this.selectItem, "id"+item.szi_ex8 , num); 
                                this.$set(this.selectItemxm, "id"+item.szi_ex8 , num); 
                                this.$emit("addItem",JSON.stringify(item))
                                this.changeAmt();
                            }).catch(() => {
                                     
                         });
                    }

                }
               
            }
            this.changePrice=false;
            
        },
        removeItem(item){
            let num=0;
            if(this.selectItem["id"+item.szi_ex8])
                num=this.selectItem["id"+item.szi_ex8]
            num--;
            if(num<0)
                num=0;
            this.$set(this.selectItem, "id"+item.szi_ex8 , num); 
            this.$set(this.selectItemxm, "id"+item.szi_ex8 , num); 
            let data={};
            data.id=item.szi_ex8;
            data.sf_ex24=item.sf_ex24;
            data.num=num;
            this.$emit("removeItem",JSON.stringify(data))
            this.changeAmt();
        },
        goSearch(){
            if(this.oldname!=this.names){
                this.oldname=this.names;
                if(this.sfItemDatas){
                    if(this.searchTime){
                        window.clearTimeout(this.searchTime)
                    }
                    window.setTimeout(()=>{
                        let items=[];
                        console.log(this.sfItemDatas.length+"=="+this.names,"sfItems==========")
                        for(let i=0;i<this.sfItemDatas.length;i++){
                            let d=this.sfItemDatas[i];
                            let szi_ex1=d.szi_ex1;
                            let szi_ex2=d.szi_ex2;
                            let sf_ex6=d.sf_ex6;
                            let sf_ex1=d.sf_ex1;
                            let sf_ex53=d.sf_ex53;

                            if(!sf_ex53){
                                sf_ex53="";
                            }
                            if(!sf_ex1){
                                sf_ex1="";
                            }
                            if(!sf_ex6){
                                sf_ex6="";
                            }
                            if(!szi_ex2){
                                szi_ex2="";
                            }
                            if(szi_ex1.indexOf(this.names)!=-1||szi_ex2.indexOf(this.names)!=-1||sf_ex6.indexOf(this.names)!=-1||sf_ex1.indexOf(this.names)!=-1||sf_ex53.indexOf(this.names)!=-1){
                                if(items.length<=100)
                                    items.push(d)
                                else{
                                    break;
                                }
                            }
                        }
                        this.tableData=items;
                        console.log(this.tableData,"this.tableData==");
                    },500)
                    
                }else{
                    let sef=this;
                    this.$post(this.appid,this.postUrl,{type:this.type,pId:this.treePId,name:this.names,type3:escape(this.type2),dw:this.dw,depart:this.depart,isWarehouse:this.isWarehouse}).then(data=>{
                    
                        sef.tableData=[];
                        for(let i=0;i<data.item.length;i++){
                            if(!data.item[i].sf_ex50)
                                //data.item[i].sf_ex50=localStorage.getItem("imgIp")+"/rootImg/sl/zw.png"
                                data.item[i].sf_ex50="/rootImg/sl/zw3.png"
    
                            if(data.item[i].sf_ex59!='Y')
                                sef.tableData.push(data.item[i])
                        }
                    
                    })
                }
            }
           
            
            /**/
        },
        changeShowType(type){
            this.showType=type;
            let sCode=localStorage.getItem("sCode");
            localStorage.setItem(sCode+"showType",type)
        }
    }
}

  
export default funeralShowMixin;
  